package com.hl.sfzy.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hl.sfzy.entity.Usermark;
import com.hl.sfzy.mapper.UsermarkMapper;
import com.hl.sfzy.service.UserMarkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserMarkServiceImpl implements UserMarkService {
    @Autowired
    private UsermarkMapper usermarkMapper;


    @Override
    public int remove(Long id) {
        return usermarkMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int add(Usermark record) {
        return usermarkMapper.insertSelective(record);
    }

    @Override
    public int edit(Usermark record) {
        return usermarkMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public Usermark findById(Long id) {
        return usermarkMapper.selectByPrimaryKey(id);
    }
    @Override
    public PageInfo<Usermark> findAll(int pageNum, int pageSize, Usermark usermark) {
        PageHelper.startPage(pageNum,pageSize);
        List<Usermark> list = usermarkMapper.selectAll(usermark);
        PageInfo<Usermark> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }
    @Override
    public List<Usermark> findByConsultId(Integer consultId) {
        return usermarkMapper.findByConsultId(consultId);
    }
}
